//
//  ZDBMyTastCell.m
//  ZDB
//
//  Created by Kk on 2020/3/26.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "ZDBMyTastCell.h"

@implementation ZDBMyTastCell

- (void)awakeFromNib {
    [super awakeFromNib];
    KViewBorder(_BG, ColorStr(@"#e9e9e9"), 0.5);
    KViewRadius(_BG, 4);
    _BG.backgroundColor = WHITECOLOR;
    _msgLab.hidden = YES;
    self.selectionStyle = UITableViewCellAccessoryNone;
}
- (void)setModel:(ZDBTastModel *)model
{
    _model = model;
     _msgLab.hidden = YES;
//    [_icon sd_setImageWithURL:[NSURL URLWithString:model.taskUrl] placeholderImage:PlaceHolderImage];
    [_icon sd_setImageWithURL:[NSURL URLWithString:model.taskUrl] placeholderImage:[UIImage imageNamed:@"renwunoon"]];
    switch (model.state.integerValue) {//任务状态 1=进行中 2=审核中 3=已完成 4=已过期 5=审核失败
        case 1:
            _taskStatus.text = kFormat(@"任务状态：%@", @"进行中");
            break;
        case 2:
            _taskStatus.text = kFormat(@"任务状态：%@", @"审核中");
            break;
        case 3:
            _taskStatus.text = kFormat(@"任务状态：%@", @"已完成");
            break;
        case 4:
            _taskStatus.text = kFormat(@"任务状态：%@", @"已过期");
            break;
        case 5:
            _taskStatus.text = kFormat(@"任务状态：%@", @"审核失败");
             _msgLab.hidden = NO;
            _msgLab.text = kFormat(@"审核回复：%@", _model.errorInfo);
            break;
        default:
            break;
    }
    _time.text = kFormat(@"领取时间：%@", kStringIsEmpty(_model.receiveTime)?@"":_model.receiveTime);
    NSString * price = kFormat(@" ¥%@", model.money);
    NSString * integral = kFormat(@" %@", model.integral);
    _price.attributedText = [ZBDUnit getcontent:price image:@"coins" index:0 imageframe:CGRectMake(0, -3, 16, 16)];
    _integralLab.attributedText = [ZBDUnit getcontent:integral image:@"jifen" index:0 imageframe:CGRectMake(0, -1, 12, 12)];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
